package com.yanqu.road.server.cmd.systemgroup;

import com.yanqu.road.entity.systemgroup.common.SystemServerGroupWeekData;
import com.yanqu.road.logic.pb.ServerSystemGroupPb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.union.SystemGroupMatchProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.manger.systemgroup.CrossSystemGroupMgr;
import com.yanqu.road.server.protocol.Protocol;
import io.netty.channel.ChannelHandlerContext;

@Cmd(code = Protocol.S_CROSS_SYSTEM_MATCH_GROUP_SYNC, desc = "跨服系统同步分组信息")
public class ServerSystemMatchGroupSyncCmd implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage yanQuMessage) throws Exception {
        SystemGroupMatchProto.Cross3NotifyMatchGroupToGameMsg msg = SystemGroupMatchProto.Cross3NotifyMatchGroupToGameMsg.parseFrom(yanQuMessage.getBytes());
        SystemServerGroupWeekData weekData = ServerSystemGroupPb.parseMatchGroupTemp(msg.getGroup());

        CrossSystemGroupMgr.syncMatchGroup(msg.getWeekId(), msg.getSystemId(), weekData);
    }
}
